package com.design.builder;

import com.design.util.XMLUtil;

/**
 * @author leali
 * @title: BuilderClient
 * @projectName design
 * @description: BuilderClient
 * @date 2022/1/2 21:56
 */
public class BuilderClient {
    public static void main(String[] args) {
        //反射生成具体建造者对象
        ActorBuilder actorBuilder = (ActorBuilder) XMLUtil.getValueByTagName("builderName", 0, true);
        ActorController actorController = new ActorController();
        //通过指挥者创建完整的建造者对象
        assert actorBuilder != null;
        Actor actor = actorController.construct(actorBuilder);
        String type = actor.getType();
        System.out.println(type + "的外观：");
        System.out.println("性别：" + actor.getSex());
        System.out.println("面容：" + actor.getFace());
        System.out.println("服装：" + actor.getCostume());
        System.out.println("发型：" + actor.getHairstyle());
    }
}
